Clip intermediate textures
authorMatthias Clasen <mclasen@redhat.com>
Sun, 1 Oct 2017 23:17:39 +0000 (19:17 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 1 Oct 2017 23:22:04 +0000 (19:22 -0400)
commit3aaea0ef406f143cb4f0a262c65f0f5ea593cf00
treebf0683df4288cd2e8b70be47cd7a17a73cb31967
parent0f6574dd05bfbbcc68f5f786c82c316e84fbfd5b
Clip intermediate textures

In some cases, we were creating gigantic intermediate textures
only to clip out a small section afterwards (e.g. in the listbox
example in gtk4-demo). This is wasteful if we apply effects on
the texture, such as blur or color-matrix. So, clip the dimensions
of the intermediate texture with the current clip. To make this
feasible, we move the texture coordinate computation out of the
pipeline setup functions into the node_as_texture function where
this clipping happens.

One extra complication we encounter is that the node might get
clipped away completely. Since Vulkan does not allow to create
empty images, we bail out in this case and not draw anything.

With these changes, the listbox example in gtk4-demo goes from
32M pixels of intermediate texture to 320000.
gsk/gskvulkanblendmodepipeline.c
gsk/gskvulkanblurpipeline.c
gsk/gskvulkanblurpipelineprivate.h
gsk/gskvulkancrossfadepipeline.c
gsk/gskvulkaneffectpipeline.c
gsk/gskvulkaneffectpipelineprivate.h
gsk/gskvulkanrenderpass.c
gsk/gskvulkantexturepipeline.c